/*
 * Created by: Peter Weissbrod
 * Created: Saturday, November 03, 2007
 */
using System;
using System.Collections.Generic;

namespace EntityLayer
{
    public class Enumerations
    {
        #region CommentStatusTypes enum
        public enum CommentStatusTypes
        {
            Null = 0,
            Active = 1,
            Inactive = 2
        }
        #endregion

        #region EntityPropertyTypes enum
        public enum EntityPropertyTypes
        {
            Null = 0,
            Image = 1,
            Description = 2
        }
        #endregion

        #region MediaTypes enum
        public enum MediaTypes
        {
            Null = 0,
            CD = 1,
            DVD = 2,
            VHS = 3,
            Software = 4
        }
        #endregion

        #region SalesItemStatusTypes enum
        public enum SalesItemStatusTypes
        {
            Null = 0,
            Open = 2,
            Sold = 3,
            Aborted = 4
        }
        #endregion

        #region UserPrivileges enum
        public enum UserPrivileges
        {
            Null = 0,
            StandardUser = 1
        }
        #endregion
        /// <summary>
        /// Get a strong-typed list of any type of these enumerations
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static List<T> GetAllEnumerationsForDisplay<T>()
        {
            Type enumType = typeof (T);
            if (enumType.BaseType != typeof (Enum))
                throw new ArgumentException("T must be of type System.Enum");
            Array enumValArray = Enum.GetValues(enumType);
            List<T> enumValList = new List<T>(enumValArray.Length);
            foreach (int val in enumValArray)
            {
                if(val==0) continue;
                enumValList.Add((T) Enum.Parse(enumType, val.ToString()));
            }
            return enumValList;
        }
    }
}